package aplicacao;

import aplicacao.campeonato.CRUDCampeonato;
import aplicacao.categoria.CRUDCategoria;
import aplicacao.equipe.CRUDEquipe;
import aplicacao.lutador.CRUDLutador;
import modelo.Parametros;
import modelo.dao.ConexaoJPA;

/**
 *
 */
public class Principal extends javax.swing.JFrame {
        
    /** Creates new form Principal */
    public Principal() {
        
        initComponents();
        
        util.Util.ajustaLookFeel(this);
        
        this.setLocationRelativeTo(null);
        
        ConexaoJPA.getInstance().getEntityManager();
        
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnFundo = new javax.swing.JPanel();
        tkd = new javax.swing.JLabel();
        jmbPrincipal = new javax.swing.JMenuBar();
        jmLutadores = new javax.swing.JMenu();
        jmEquipes = new javax.swing.JMenu();
        jmCategorias = new javax.swing.JMenu();
        jmCampeonatos = new javax.swing.JMenu();
        jmConfiguracoes = new javax.swing.JMenu();
        jmSair = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Tae Kwon Do Champ Manager");

        pnFundo.setBackground(new java.awt.Color(58, 110, 165));

        tkd.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        tkd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aplicacao/imagens/TaeKwonDo.jpg"))); // NOI18N

        javax.swing.GroupLayout pnFundoLayout = new javax.swing.GroupLayout(pnFundo);
        pnFundo.setLayout(pnFundoLayout);
        pnFundoLayout.setHorizontalGroup(
            pnFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tkd, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
        );
        pnFundoLayout.setVerticalGroup(
            pnFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tkd, javax.swing.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE)
        );

        jmLutadores.setText("Lutadores");
        jmLutadores.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jmLutadoresMousePressed(evt);
            }
        });
        jmbPrincipal.add(jmLutadores);

        jmEquipes.setText("Equipes");
        jmEquipes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jmEquipesMousePressed(evt);
            }
        });
        jmbPrincipal.add(jmEquipes);

        jmCategorias.setText("Categorias");
        jmCategorias.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jmCategoriasMousePressed(evt);
            }
        });
        jmbPrincipal.add(jmCategorias);

        jmCampeonatos.setText("Campeonatos");
        jmCampeonatos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jmCampeonatosMousePressed(evt);
            }
        });
        jmbPrincipal.add(jmCampeonatos);

        jmConfiguracoes.setText("Configurações");
        jmbPrincipal.add(jmConfiguracoes);

        jmSair.setText("Sair");
        jmSair.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jmSairMousePressed(evt);
            }
        });
        jmbPrincipal.add(jmSair);

        setJMenuBar(jmbPrincipal);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnFundo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnFundo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmCampeonatosMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmCampeonatosMousePressed
        new CRUDCampeonato(this, true);
    }//GEN-LAST:event_jmCampeonatosMousePressed

    private void jmCategoriasMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmCategoriasMousePressed
        new CRUDCategoria( this, true);
    }//GEN-LAST:event_jmCategoriasMousePressed

    private void jmEquipesMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmEquipesMousePressed
        new CRUDEquipe( this, true);
    }//GEN-LAST:event_jmEquipesMousePressed

    private void jmLutadoresMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmLutadoresMousePressed
        new CRUDLutador( this, true);
    }//GEN-LAST:event_jmLutadoresMousePressed

    private void jmSairMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmSairMousePressed
        System.exit(0);
    }//GEN-LAST:event_jmSairMousePressed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Principal().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jmCampeonatos;
    private javax.swing.JMenu jmCategorias;
    private javax.swing.JMenu jmConfiguracoes;
    private javax.swing.JMenu jmEquipes;
    private javax.swing.JMenu jmLutadores;
    private javax.swing.JMenu jmSair;
    private javax.swing.JMenuBar jmbPrincipal;
    private javax.swing.JPanel pnFundo;
    private javax.swing.JLabel tkd;
    // End of variables declaration//GEN-END:variables
    
}
